//
// Copyright (C) [2024] Xingyun Integrated Circuit, Inc.
//
// GreenCode was a private technology asset of Xingyun Integrated Circuit， Inc （Confidential）
//  Author: Shawn.Tan
//  Date : 2025.10.28
//
//  History : Initial Version 2025.10.28
//
//
#include "RegisterInitPolicy.h"

#include "Generator.h"
#include "Log.h"
#include "PageTable.h"
#include "Register.h"
#include "UtilityFunctions.h"

using namespace std;

namespace Green {

  void InitPolicyTuple::Setup(const RegisterFile* pRegisterFile)
  {
    mpInitPolicy = pRegisterFile->GetInitPolicy(mPolicyName);
  }

  void RegisterInitPolicy::Setup(const Generator* pGen)
  {
    mpGenerator = pGen;
    mpRegisterFile = pGen->GetRegisterFile();
  }

  void RegisterInitPolicy::InitializeRegister(Register* pRegister) const
  {
    REPORT_UNIMPLEMENTED_METHOD;
  }

  void RegisterInitPolicy::InitializeRegisterField(RegisterField* pRegField, const ChoiceTree* pChoiceTree) const
  {
    REPORT_UNIMPLEMENTED_METHOD;
  }

  uint64 RegisterInitPolicy::RegisterReloadValue(Register* pRegister) const
  {
    REPORT_UNIMPLEMENTED_METHOD;
    return 0;
  }

  uint64 RegisterInitPolicy::RegisterFieldReloadValue(RegisterField* pRegField) const
  {
    REPORT_UNIMPLEMENTED_METHOD;
    return 0;
  }

  void RegisterInitPolicy::SetRegisterFieldInitialValue(RegisterField* pRegField, uint64 value) const
  {
    // Directly call RegisterField::InitializeField, since the RegisterInitPolicy is called from inside RegisterField::InitializeRandomly.
    pRegField->InitializeField(value);
  }

  void RegisterInitPolicy::SetRegisterInitialValue(Register* pRegister, uint64 value) const
  {
    pRegister->Initialize(value);
  }

}
